<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const age = 28;
        const name = "xulei";
        const person1 = {
            age: age,
            name: name
        }
        const person2 = {
            age,
            name
        }
        console.log(person1.name)
            // 字符串插值表达式
        const message = `我的名字是${person1.name},我的年龄是${person1.age}`
        console.log(message)

        const person = {
            name: "jack",
            age: 30,
            language: ["java", "javascript", 'css'],
            hello: (person) => {
                console.log(`hello,我是${person.name},我的年龄是${person.age},我会的技能是${person.language}`)
            }
        }
        person.hello(person)

        const target = {
            a: 1
        }
        const source1 = {
            b: 2
        }
        const source2 = {
            c: 3
        }
        Object.assign(target, source1, source2)
        console.log(target)


        let person3 = {
            name: "Tom",
            age: 29,
            language: ["java", "es"],
            eat: function(food) {
                console.log(this.name + " 在吃 " + food)
            }
        }

        person3.eat("香蕉")

        let someone = {...person3
        }
        someone.language = ["java"]
        someone.eat("米饭")
    </script>
</body>

</html>